#include<iostream>
using namespace std;



int main()
{
    int n;
    int min = 10000;
    int max = -1;
    cin >> n;
    int x;
    for(int i = 1; i <= n; i++)
    {
        cin >> x;
        min = (min < x) ? min : x;
        max = (max > x) ? max : x;
        
    }
    cout << max - min << endl;
    return 0;
}